<?php
require $_SERVER["DOCUMENT_ROOT"] . "/aonce_connect.php";

/*
 * Queries de obtenci'on de informaci'on de artista 
 */
$artista_fields = "idartista, nombreartista AS nombre, fotoartista AS foto, MAX(idserie) AS idserie";
$artista_query = "SELECT $artista_fields FROM artista, serie WHERE serie.artista=artista.idartista GROUP BY idartista;";
//echo $artista_query;

/*
 * Conexion a DB y ejecuci'on de queries
 */
$link = conecta();
$artista_result = $link->query($artista_query);
$link->close();

/*
 * Asociaci'on de datos de artista y serie con variables
 */
	$c=0;
	while($artista_data = $artista_result->fetch_assoc()){
		$artistList .= sprintf("<li onMouseOver=\"this.style.backgroundColor='#f3f3f3';\" onMouseOut=\"this.style.backgroundColor=''; \"><a href=\"artista.php?artista=%d&serie=%d\" onMouseover=\"changeimage(myimages[%d],this.href)\">%s</a></li>", $artista_data["idartista"], $artista_data["idserie"], $c++, $artista_data["nombre"]);
		$imgSrc .="\"uploads/$artista_data[foto]\", ";
	}
	$imgSrc = substr($imgSrc, 0, -2);

?>
<!--Force IE6 into quirks mode with this comment tag-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Alternativa Once</title>
<link href="styleIndex.css" rel="stylesheet" type="text/css" />
<script>
  function changeimage(towhat,url){
    if (document.images){
      document.images.targetimage.src=towhat.src
      gotolink=url
    }
  }
  
  function warp(){
    window.location=gotolink
  }
  
  </script>
  
  <script language="JavaScript1.1">
  var myimages=new Array()
  var gotolink="#"
  
  function preloadimages(){
    for (i=0;i<preloadimages.arguments.length;i++){
    myimages[i]=new Image()
    myimages[i].src=preloadimages.arguments[i]
    }
  }
  
  preloadimages(<?php echo $imgSrc;?>);
		  
</script>
</head>
<body>

<div id="framecontent">
<div class="seccioninterior">

<?php require "foot.php";?>

</div>
</div>

<div id="maincontent">
<?php require "head.php";?>

<div class="seccioninterior" style="margin-top:80px; ">

<div class="cuadroIzquierdoExpoAnterior" align="center">
<img src="images/img01.gif" name="targetimage" border=0>
</div>

<div id="menuartistas" class="menuArtistasCuadro">
  <ul style="list-style-type:none">
	<?php
	echo $artistList;
	?>
  </ul>  
</div>

</div>
</div>


</body>
</html>
